package com.gaofeng.day11;

/**
 * @author gaofeng
 * @date 2024-12-22 - 12:35
 */
public class demo03 {
    public static void main(String[] args) {
        // 动态初始化
        int[] arr = new int[3];
        System.out.println(arr[2]);

        // 求最大值
        int[] arr2 = {1,2,83,4,65};

        int max = arr[0];

        for (int i = 1; i <arr2.length ; i++) {
            if(arr2[i] > max){
                max = arr2[i];
            }
        }
        System.out.println(max);

        // 求最小值
        int min = arr2[0];
        for (int i = 0; i < arr2.length; i++) {
            if(arr2[i] < min){
                min = arr2[i];
            }
        }
        System.out.println(min);
    }
}
